package com.ruoyi.payLog.domain;

import java.math.BigDecimal;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 支付记录信息对象 wdm_payment_logs
 * 
 * @author ruoyi
 * @date 2025-06-16
 *
 */
@Data
public class PayLogs extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 支付记录ID（主键） */
    private Long paymentId;

    /** 订单ID */
    @Excel(name = "订单ID")
    private Long orderId;

    /** 支付方式 */
    @Excel(name = "支付方式")
    private String paymentMethod;

    /** 支付状态（0=待支付 1=已支付 2=支付失败） */
    @Excel(name = "支付状态", readConverterExp = "0=待支付,1=已支付,2=支付失败")
    private String paymentStatus;

    /** 第三方支付订单号 */
    @Excel(name = "第三方支付订单号")
    private String transactionId;

    /** 退款状态：0=待退款 1=申请退款 2=退款中 3=已退款 4=退款失败 */
    @Excel(name = "退款状态", readConverterExp = "0=待退款 1=申请退款 2=退款中 3=已退款 4=退款失败")
    private String refundStatus;

    /** 支付金额 */
    @Excel(name = "支付金额")
    private BigDecimal amount;

    /** 退款金额 */
    @Excel(name = "退款金额")
    private BigDecimal refundAmount;

    /** 支付账号（微信openid/支付宝userid） */
    @Excel(name = "支付账号", readConverterExp = "微=信openid/支付宝userid")
    private String payerId;

    /** 支付设备信息 */
    @Excel(name = "支付设备信息")
    private String deviceInfo;

    /** 支付成功时间 */
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    @Excel(name = "支付成功时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
//    private Date paymentTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", timezone = "GMT+8")
    private Date paymentTime;

    /** 退款成功时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "退款成功时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date refundTime;

    /** 状态 */
    @Excel(name = "状态")
    private String status;

    /** 删除 */
    private String delFlag;

    /** 版本号 */
    @Version
    private Long version;

    /** 微信预交易订单编号 */
    @Excel(name = "微信预交易订单编号")
    private String prepayId;

    /** 微信支付二维码 */
    @Excel(name = "微信支付二维码")
    private String qrCodeUrl;

    /** 商品订单ID */
    private Long goodsOrderId;


    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("paymentId", getPaymentId())
            .append("orderId", getOrderId())
            .append("paymentMethod", getPaymentMethod())
            .append("paymentStatus", getPaymentStatus())
            .append("transactionId", getTransactionId())
            .append("refundStatus", getRefundStatus())
            .append("amount", getAmount())
            .append("refundAmount", getRefundAmount())
            .append("payerId", getPayerId())
            .append("deviceInfo", getDeviceInfo())
            .append("paymentTime", getPaymentTime())
            .append("refundTime", getRefundTime())
            .append("status", getStatus())
            .append("delFlag", getDelFlag())
            .append("version", getVersion())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .append("createBy", getCreateBy())
            .append("updateBy", getUpdateBy())
            .append("remark", getRemark())
            .append("goodsOrderId", getGoodsOrderId())
            .toString();
    }
}
